var DOMUtil = {
clearChildren: function(parent) {
   while (parent.childNodes.length>0) {
      parent.removeChild(parent.childNodes.item(0));
   }
},

forChild: function(parent,namespace,name,handler) {
   var current = parent.firstChild;
   while (current) {
      if (current.nodeType!=1) {
         current = current.nextSibling;
         continue;
      }
      //alert("{"+current.namespaceURI+"}"+current.localName+" vs {"+namespace+"}"+name);
      if (current.localName==name && current.namespaceURI==namespace) {
         handler(current);
      }
      current = current.nextSibling;
   }
},

textOf: function(parent,namespace,name) {
   var text = "";
   var current = parent.firstChild;
   while (current) {
      if (current.nodeType!=1) {
         current = current.nextSibling;
         continue;
      }
      //alert("{"+current.namespaceURI+"}"+current.localName+" vs {"+namespace+"}"+name);
      if (current.localName==name && current.namespaceURI==namespace) {
         text += current.textContent;
      }
      current = current.nextSibling;
   }
   return text;
}

}